package com.study.javaBasic.multithreading;

public class ThreadLocalMainTest {
    private final static ThreadLocal<String> THREAD_LOCAL=new ThreadLocal<>();
    public static void main(String[] args) {
        new Thread(()->{
            THREAD_LOCAL.set("1");
            while(true){
                System.out.println(Thread.currentThread().getName()+":THREAD_LOCAL.get() = " + THREAD_LOCAL.get());
            }
        }).start();
        new Thread(()->{
            THREAD_LOCAL.set("2");
            while(true){
                System.out.println(Thread.currentThread().getName()+":THREAD_LOCAL.get() = " + THREAD_LOCAL.get());
            }
        }).start();
    }
}
